USE BIDDINGFEE
GO

/****** Object:  Table [dbo].[GroupPermission]    Script Date: 01/06/2013 21:46:04 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[GroupPermission](
	[FunctionId] [int] NOT NULL,
	[GroupId] [int] NOT NULL,
	[Mash] [int] NOT NULL,
	[Description] [nvarchar](500) NULL,
	[Deleted] [bit] NOT NULL,
	[Active] [bit] NOT NULL,
	[CreateDate] [datetime] NOT NULL,
	[CreateBy] [nvarchar](50) NOT NULL,
	[UpdateDate] [datetime] NOT NULL,
	[UpdateBy] [nvarchar](50) NOT NULL,
 CONSTRAINT [PK_GroupPermission] PRIMARY KEY CLUSTERED 
(
	[FunctionId] ASC,
	[GroupId] ASC,
	[Mash] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[GroupPermission]  WITH CHECK ADD  CONSTRAINT [FK_GroupPermission_BiddingFunction] FOREIGN KEY([FunctionId])
REFERENCES [dbo].[BiddingFunction] ([Id])
ON UPDATE CASCADE
ON DELETE CASCADE
GO

ALTER TABLE [dbo].[GroupPermission] CHECK CONSTRAINT [FK_GroupPermission_BiddingFunction]
GO

ALTER TABLE [dbo].[GroupPermission]  WITH CHECK ADD  CONSTRAINT [FK_GroupPermission_Group] FOREIGN KEY([GroupId])
REFERENCES [dbo].[Group] ([Id])
GO

ALTER TABLE [dbo].[GroupPermission] CHECK CONSTRAINT [FK_GroupPermission_Group]
GO

